package tools;

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;

public class TestInsert {
    public static void main(String[] args) {
        Connection con=null;
        Statement st=null;
        ResultSet rs=null;
        try {
            //获取数据库连接
            con=utils.getConnection();
            //创建数据库连接
            st=con.createStatement();
            String sql="INSERT INTO food(`id`,`name`,`introduce`,`money`) VALUES(7,'xzy','hhh','10000')";
            int i=st.executeUpdate(sql);
            if(i>0){
                System.out.println("插入成功");
            }
        } catch (SQLException e) {
            e.printStackTrace();
        }finally {
            utils.release(rs,st,con);
        }
    }
}
